import 'package:flutter/material.dart';

class Factory2 extends StatelessWidget{
  @override
  Widget build (BuildContext context){
    return  CustomScrollView(
      shrinkWrap: true,
      slivers: <Widget>[
        SliverAppBar(
          primary: true,  //是否预留高度
          forceElevated:false,
          automaticallyImplyLeading:true,
          titleSpacing: NavigationToolbar.kMiddleSpacing,
          snap:false,   //与floating结合使用
          expandedHeight: 200.0,//展开高度
          floating: false,//是否随着滑动隐藏标题
          pinned: true,//是否固定在顶部
          flexibleSpace: FlexibleSpaceBar( //可以展开区域，通常是一个FlexibleSpaceBar
              centerTitle: true,
              title: Text("我是一个帅气的标题2",
                  style: TextStyle(
                    color: Colors.white,
                    fontSize: 16.0,
                  )),
              background: Image.network(
                //"http://h.hiphotos.baidu.com/image/pic/item/342ac65c103853434cc02dda9f13b07eca80883a.jpg",
                //"http://b.zol-img.com.cn/desk/bizhi/image/6/960x600/1432800027589.jpg",
                "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1531798262708&di=53d278a8427f482c5b836fa0e057f4ea&imgtype=0&src=http%3A%2F%2Fh.hiphotos.baidu.com%2Fimage%2Fpic%2Fitem%2F342ac65c103853434cc02dda9f13b07eca80883a.jpg",
                fit: BoxFit.fill,
              )),
        ),
        SliverPadding(
          padding: const EdgeInsets.all(20.0),
          sliver: SliverList(
            delegate: SliverChildListDelegate(
              <Widget>[
                const Text('I\'m dedicating every dddday to you!!!!'),
                const Text('Domestic life was never quite my style'),
                const Text('When you smile, you knock me out, I fall apart'),
                const Text('And I thought I was so smart'),
              ],
            ),
          ),
        ),
        SliverGrid(
          gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(
            maxCrossAxisExtent: 200.0,
            mainAxisSpacing: 10.0,
            crossAxisSpacing: 10.0,
            childAspectRatio: 4.0,
          ),
          delegate: SliverChildBuilderDelegate(
                (BuildContext context, int index) {
              return Container(
                alignment: Alignment.center,
                color: Colors.teal[100 * (index % 9)],
                child: Text('Grid Item $index'),
              );
            },
            childCount: 20,
          ),
        ),
        SliverFixedExtentList(
          itemExtent: 50.0,
          delegate: SliverChildBuilderDelegate(
                (BuildContext context, int index) {
              return Container(
                alignment: Alignment.center,
                color: Colors.lightBlue[100 * (index % 9)],
                child: Text('List Item $index'),
              );
            },
          ),
        ),

      ],
    );
  }
}